Stored Procedures [dbo].[aspnet_Profile_GetNumberOfInactiveProfiles]
Properties
PropertyValue
ANSI Nulls OnNo
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@ApplicationNamenvarchar(256)512
@ProfileAuthOptionsint4
@InactiveSinceDatedatetime8
Permissions
TypeActionOwning Principal
GrantExecuteaspnet_Profile_ReportingAccess
SQL Script
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE dbo.aspnet_Profile_GetNumberOfInactiveProfiles
    @ApplicationName        nvarchar(256),
    @ProfileAuthOptions     int,
    @InactiveSinceDate      datetime
AS
BEGIN
    DECLARE @ApplicationId uniqueidentifier
    SELECT  @ApplicationId = NULL
    SELECT  @ApplicationId = ApplicationId FROM aspnet_Applications WHERE LOWER(@ApplicationName) = LoweredApplicationName
    IF (@ApplicationId IS NULL)
    BEGIN
        SELECT 0
        RETURN
    END

    SELECT  COUNT(*)
    FROM    dbo.aspnet_Users u, dbo.aspnet_Profile p
    WHERE   ApplicationId = @ApplicationId
        AND u.UserId = p.UserId
        AND (LastActivityDate <= @InactiveSinceDate)
        AND (
                (@ProfileAuthOptions = 2)
                OR (@ProfileAuthOptions = 0 AND IsAnonymous = 1)
                OR (@ProfileAuthOptions = 1 AND IsAnonymous = 0)
            )
END
GO
GRANT EXECUTE ON  [dbo].[aspnet_Profile_GetNumberOfInactiveProfiles] TO [aspnet_Profile_ReportingAccess]
GO
Uses